/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#ifndef INCLUDE_SHADER_TEXTURE
#define INCLUDE_SHADER_TEXTURE

#include "shader_built_in_functions.h"

#ifdef __cplusplus

// GLSL Type
using uint = unsigned int;

#define in
#define out
#define inout


//��������
Inline float f_texture_Gradient(in vec3 coord, in int type) {
	switch (type) {
	case 0: {
		vec4 plane = f_plane(coord, {1, 0, 0});
		if (dot(coord, {1, 0, 0}) >= 0) return min(f_graph_point_to_plane_dis(plane, coord), 1);
		else return 0;
	}

	case 1:
		return max(1 - (dot(coord, coord)), 0);
	default:
		break;
	}
	return 0;
}



#else


#define Inline


//��������
Inline float f_texture_Gradient(in vec3 coord, in int type) {
	switch (type) {
	case 0: {
		vec4 plane = f_plane(coord, vec3(1, 0, 0));
		if (dot(coord, vec3(1, 0, 0)) >= 0) return min(f_graph_point_to_plane_dis(plane, coord), 1);
		else return 0;
	}

	case 1:
		return max(1 - (dot(coord, coord)), 0);
	default:
		break;
	}
	return 0;
}



#endif




//���̸�����
Inline float f_texture_Checker(in vec3 coord, in vec3 size) {
	vec3 c = floor(coord * size) / 2;
	return fract(c.x + c.y + c.z) * 2;
}



#endif //NOISE



